<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <title>蜗牛车辆预约</title>
        <meta name="description" content="蜗牛车辆预约">
        <meta name="keywords" content="蜗牛车辆预约">
        <meta content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no" name="viewport">
        <link rel="stylesheet" href="../plugins/elementui/index.css">
        <link rel="stylesheet" href="../plugins/font-awesome/css/font-awesome.min.css">
        <link rel="stylesheet" href="../css/style.css">
    </head>
    <body class="hold-transition">
        <div id="app">
            <div class="content-header">
                <h1>车辆类型管理<small>车辆类型列表</small></h1>
                <el-breadcrumb separator-class="el-icon-arrow-right" class="breadcrumb">
                    <el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
                    <el-breadcrumb-item>车辆类型管理</el-breadcrumb-item>
                </el-breadcrumb>
            </div>
            <div class="app-container">
                <div class="box">
                     <div class="filter-container">
                         <el-form :inline="true">
                             <el-input placeholder="类型名称" v-model="name" style="width: 200px;" class="filter-item"></el-input>
                             <el-button type="primary" icon="el-icon-search" @click="initData">查询</el-button>
                             <el-button type="primary" class="butT" @click="handleToAdd">新增</el-button>
                         </el-form>
                    </div>
                    <el-table size="small" current-row-key="id" :data="dataList" stripe highlight-current-row>
                        <el-table-column type="index" align="center" label="序号"></el-table-column>
                        <el-table-column prop="name" label="类型名称" align="center"></el-table-column>
                        <el-table-column prop="minPrice" label="最低价格" align="center"></el-table-column>
                        <el-table-column prop="sort" label="排序" align="center"></el-table-column>
                        <el-table-column label="操作" align="center">
                            <template slot-scope="scope">
                                <el-button type="primary" size="mini" @click="handleToEdit(scope.row.id)" >编辑</el-button>
                                <el-button size="mini" type="danger" @click="handleDelete(scope.row.id)" >删除</el-button>
                            </template>
                        </el-table-column>
                    </el-table>

                    <el-pagination
                            @size-change="handleSizeChange"
                            @current-change="handleCurrentChange"
                            :current-page="currentPage"
                            :page-sizes="[1, 2, 3, 4]"
                            :page-size="pageSize"
                            layout="total, sizes, prev, pager, next, jumper"
                            :total="total">
                    </el-pagination>

                    <!-- 新增标签弹层 -->
                    <div class="add-form">
                        <el-dialog title="新增车辆类型" :visible.sync="addDialogFormVisible" :close-on-click-modal="false" >
                            <el-form label-position="right" label-width="100px" :rules="rules" :model="carType" ref="addOrEditForm">
                                <el-row>
                                    <el-col :span="12">
                                        <el-form-item label="类型名称" prop="name">
                                            <el-input v-model="carType.name" placeholder="请输入类型名称"/>
                                        </el-form-item>
                                    </el-col>
                                    <el-col :span="12">
                                        <el-form-item label="最低价格" prop="minPrice">
                                            <el-input v-model="carType.minPrice" placeholder="请输入最低价格"/>
                                        </el-form-item>
                                    </el-col>
                                </el-row>
                                <el-row>
                                    <el-col :span="12">
                                        <el-form-item label="排序">
                                            <el-input-number v-model="carType.sort" :min="1" :max="100"></el-input-number>
                                        </el-form-item>
                                    </el-col>
                                </el-row>

                            </el-form>
                            <div slot="footer" class="dialog-footer">
                                <el-button @click="addDialogFormVisible = false">取消</el-button>
                                <el-button type="primary" @click="handleAddOrEdit()">确定</el-button>
                            </div>
                        </el-dialog>
                    </div>
                </div>
            </div>
        </div>
    </body>
    <!-- 引入组件库 -->
    <script src="../js/vue.js"></script>
    <script src="../plugins/elementui/index.js"></script>
    <script type="text/javascript" src="../js/jquery.min.js"></script>
    <script src="../js/axios-0.18.0.js"></script>
    <script>
        new Vue({
            el: '#app',
            data:{
				dataList: [],                       // 分页数据
                carType: {},                        // 表单数据
                addDialogFormVisible: false,        // 新增表单是否可见
            },
            methods: {
            },
            // vue对象初始化之后执行的钩子函数
            created(){
            }
        })
    </script>
</html>
